<?

  $currentWealth = $this->character->getMoney();
  
  include('custom/shoptabs.php');

?><h3>Sell Stuff</h3>
<table width="550" cellpadding="0" cellspacing="0">
<?
if (sizeof($this->character->invList)>0)
{
  foreach($this->character->invList as $k => $invDS) if ($invDS['i_value'] != 0 && ($invDS['iv_quantity'] >= 1))
  {
    $rowCtr++;
    $itxt = $this->character->explainItem($invDS);
    if ($itxt != '') $itxt = toolTip(':'.$itxt);
    ?><tr id="slr_<?= $rowCtr ?>" <? if ($rowCtr % 2 == 0) print('class="tr_odd"'); ?>
      <td valign="top" width="40"><img width="32" <?= $itxt ?> src="img/<?= $invDS['i_icon'] ?>.png"/></td>
      <td valign="top" width="*">
        <span <?= $itxt ?>><b><?= $invDS['i_name'] ?></b> <? if ($invDS['iv_quantity'] != 1) print('('.$invDS['iv_quantity'].'x)'); ?><br/>
        <?= $invDS['i_description'] ?></span>
      </td>
      <td valign="top" width="64">
      <? 
        if ($itxt != '') {
          ?><img src="img/icons/restart.png" <?= $itxt ?>/><?
      } ?>    
      <?
      if ($invDS['iv_on'] == 'Y')
        print('<img src="img/icons/admin_icon.png" '.toolTip(':currently in use.').'/>');
      ?>
      </td>
      <td valign="top" nowrap width="100">
        <?
        if (1==1)
        {
          ?>
          <input type="button" name="sell" style="width: 45px" 
            onclick="$('#slr_<?= $rowCtr ?>').fadeTo('slow', 0.3); document.location='<?= actionUrl('sell', 'shop', 'sell='.$invDS['i_key'].',quantity=') ?>'+
              document.getElementById('nr_<?= $invDS['i_key'] ?>').value;"
            value="sell"/>
          <input type="text" 
            style="width: 24px;"
            size="3" id="nr_<?= $invDS['i_key'] ?>" value="1"/></td><td valign="top" nowrap width="120">
             of <b><?= $invDS['iv_quantity'] ?></b>
          for <?= round($invDS['i_value']/2) ?> GP <? if($invDS['iv_quantity']>1) print('each'); ?>           
          <?
        }
        else
        {
        ?>
        <input type="button" name="sell" style="width: 120px" 
          onclick="$('#slr_<?= $rowCtr ?>').fadeTo('slow', 0.3); document.location='<?= actionUrl('sell', 'shop', 'sell='.$invDS['i_key']) ?>';"
          value="sell for <?= round($invDS['i_value']/2) ?> gold"/>
        <?
        }
        ?>
      </td>
    </tr><?
  }
}
else
  print('<tr><td style="color: gray">Actually, you don\'t own anything!</td></tr>');
?>
</table>
